package com.rop.znyx.acl.controller;

import com.rop.znyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: IndexController
 * @Author Rop
 * @Date 2023/6/13 22:26
 * @description: 登录管理
 */

@Api(tags = "登录管理")
@RestController
@RequestMapping("admin/acl/index")
 // 解决跨域
public class IndexController {

    /**
     * 1 登录
     *
     * @return 登录信息
     */
    @ApiOperation("登录")
    @PostMapping("login")
    public Result<Map<String, Object>> login() {
        Map<String, Object> map = new HashMap<>();
        map.put("token", "admin-token");
        return Result.ok(map);
    }

    /**
     * 2 获取用户信息
     */
    @ApiOperation("获取用户信息")
    @GetMapping("info")
    public Result<Map<String, Object>> info() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", "rop");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * 3 退出
     */
    @ApiOperation("退出")
    @PostMapping("logout")
    public Result<Void> logout() {
        return Result.ok();
    }
}
